//
//  MSHomeMeCell.m
//  觅尚
//
//  Created by No.8 on 2019/3/29.
//  Copyright © 2019 No.8. All rights reserved.
//

#import "MSHomeMeCell.h"

@implementation MSHomeMeCell

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    MSHomeMeCell * cell = [tableView dequeueReusableCellWithIdentifier:[MSHomeMeCell ID]];
    cell = [[MSHomeMeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[MSHomeMeCell ID]];
    cell.backgroundColor = backgroundcolor;
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setMember];
        
    }
    return self;
}

- (void)setMember{
    /** 头像*/
    self.IMGName = [[UIImageView alloc] initWithFrame:CGRectMake(40 * px, 40 * px, 60 * px, 60 * px)];
    //    self.IMGName.image = [UIImage imageNamed:<#name#>];
    [self addSubview:self.IMGName];
    
    
    /** 名称*/
    self.TitleName = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.IMGName.frame) + 40 * px, self.IMGName.y, ScreenWidth * 0.5, self.IMGName.height)];
    self.TitleName.textColor = [UIColor whiteColor];
    self.TitleName.textAlignment = NSTextAlignmentLeft;
    self.TitleName.font = [UIFont systemFontOfSize:SYRealValue(30 / 2)];
    [self addSubview:self.TitleName];
    
    
    /** 分割线*/
    self.LineView = [[UIView alloc] initWithFrame:CGRectMake(40 * px, 140 * px - 1, ScreenWidth - 80 * px, 1)];
    self.LineView.backgroundColor = BackViewColor;
    [self addSubview:self.LineView];
    
}

- (void)setMyModel:(MSMyModel *)MyModel{
    _MyModel = MyModel;
    
    //    self.IMGName.image = [UIImage imageNamed:MyModel.imageName];
    //    if ([MyModel.key isEqualToString:@"my_companymanage"]) {
    //        self.IMGName.image = [UIImage imageNamed:@"gsgl_icon"];
    //    }else if ([MyModel.key isEqualToString:@"my_companymanage"])
    if ([MyModel.key isEqualToString:@"my_companymanage"]) {
        self.IMGName.image = [UIImage imageNamed:@"gsgl_icon"];
    }else if ([MyModel.key isEqualToString:@"my_notice"]) {
        self.IMGName.image = [UIImage imageNamed:@"tz_icon"];
    }else if ([MyModel.key isEqualToString:@"my_evaluate"]) {
        self.IMGName.image = [UIImage imageNamed:@"pjsy_icon"];
    }else if ([MyModel.key isEqualToString:@"my_examine"]) {
        self.IMGName.image = [UIImage imageNamed:@"ygsh_icon"];
    }else if ([MyModel.key isEqualToString:@"room_preservedwine"]) {
        self.IMGName.image = [UIImage imageNamed:@"wdcj_icon"];
    }else if ([MyModel.key isEqualToString:@"set_key"]) {
        self.IMGName.image = [UIImage imageNamed:@"sz_icon"];
    }else if ([MyModel.key isEqualToString:@"code_key"]) {
        self.IMGName.image = [UIImage imageNamed:@"ewm_icon"];
    }else if ([MyModel.key isEqualToString:@"my_attendance"]){
        self.IMGName.image = [UIImage imageNamed:@"rygl_icon"];
    }else if ([MyModel.key isEqualToString:@"room_history"]){
        self.IMGName.image = [UIImage imageNamed:@"fwfjjl_icon"];
    }else {
        self.IMGName.image = [UIImage imageNamed:@"gsgl_icon"];
    }
    
    self.TitleName.text = [NSString stringWithFormat:@"%@",MyModel.bay_name];
}
+(NSString *)ID{
    return @"cell";
}
@end
